package com.onesports.intelligent.k12.polarlight.mapper.course;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.onesports.intelligent.k12.polarlight.annotation.DataPermission;
import com.onesports.intelligent.k12.polarlight.domain.entity.course.CourseSellPriceRel;
import com.onesports.intelligent.k12.polarlight.domain.vo.course.CourseDetailPageVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.course.CourseSellInfo;
import com.onesports.intelligent.k12.polarlight.domain.vo.course.CourseSellPriceRelVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.course.SpellClassPriceVO;
import com.onesports.intelligent.k12.polarlight.enums.DataPermissionTypeEnum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 社区课程售价
 *
 * @author
 * @since 1.0.0 2022-07-08
 */
@Mapper
public interface CourseSellPriceRelMapper extends BaseMapper<CourseSellPriceRel> {


    /**
     * 课程售价分页
     *
     * @param page     分页参数
     * @param courseId 课程id
     * @return IPage<CourseSellPriceRelVO>
     */
    @DataPermission(DataPermissionTypeEnum.BY_CAMPUS)
    IPage<CourseSellPriceRelVO> sellPricePage(@Param("page") Page<CourseSellPriceRelVO> page, @Param("courseId") String courseId);

    /**
     * 查询出商品下--拼班类型对应的价格
     *
     * @return {@link List}<{@link SpellClassPriceVO}>
     */
    List<SpellClassPriceVO> findSpellClassPrice(@Param("productId") String productId, @Param("productCampusRelId") String productCampusRelId);

    /**
     * 通过课程ID与拼班规则ID获取信息
     *
     * @param courseId
     * @param page
     * @param mergeRuleId
     * @return
     */
    IPage<CourseDetailPageVO> getByCourseIdAndPriceId(Page<CourseDetailPageVO> page, @Param("courseId") String courseId, @Param("mergeRuleId") String mergeRuleId);

    /**
     * 获取课程售卖信息
     *
     * @param courseId 课程id
     * @param campusId 校区id
     * @return List<CourseSellInfo>
     */
    List<CourseSellInfo> courseSellInfo(@Param("courseId") String courseId, @Param("campusId") String campusId);
}
